@extends('layouts.userctl')
@section('content')
	<style>
		.roleitem{
			flex:1;
		}
		.layui-form-label {
		    width: 100px;
		}
		.layui-input-block {
		    margin-left: 120px;
		}
	</style>
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <h2>用户【{{$user->name}}】分配权限</h2>
        </div>
        <div class="layui-card-body">
            <form class="layui-form" action="{{route('admin.user.assignUsermenu',['id'=>$user->id])}}" method="post">
                {{csrf_field()}}
                {{method_field('put')}}
				<div style="width:100%;display:flex;flex-direction:row;">
					<div class="layui-form-item roleitem">
					    <label for="" class="layui-form-label">后台权限</label>
					    <div class="layui-input-block" style="width: 400px">
					        @forelse($menus as $menu)
					            <dl class="cate-box">
					                <dt>
					                    <div class="cate-first">
					                        <input id="roles{{$menu->id}}" type="checkbox" name="permissions[]"
					                               value="{{$menu->id}}" title="{{$menu->title}}"
					                               lay-skin="primary" {{ isset($menu->own)?'checked':''}} ></div>
					                </dt>
					            </dl>
					        @empty
					            <div style="text-align: center;padding:20px 0;">
					                无数据
					            </div>
					        @endforelse
					    </div>
					</div>
					<div class="layui-form-item roleitem">
					    <label for="" class="layui-form-label">手机端权限</label>
					    <div class="layui-input-block" style="width: 400px">
					        @forelse($menus2 as $menu)
					            <dl class="cate-box">
					                <dt>
					                    <div class="cate-first">
					                        <input id="roles{{$menu->id}}" type="checkbox" name="permissions2[]"
					                               value="{{$menu->id}}" title="{{$menu->name}}"
					                               lay-skin="primary" {{ isset($menu->own)?'checked':''}} ></div>
					                </dt>
					            </dl>
					        @empty
					            <div style="text-align: center;padding:20px 0;">
					                无数据
					            </div>
					        @endforelse
					    </div>
					</div>
					
				</div>
                
                <div class="layui-form-item">
                    <div class="layui-input-block" style="display: flex;flex-direction: row;justify-content: center;width: 60%;">
                        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formDemo">确 认</button>
                        <a class="layui-btn layui-btn-normal" href="{{route('admin.user.userlist')}}">返 回</a>
                    </div>
                </div>
            </form>
        </div>
    </div>

@endsection
